package com.liuyutao.Student.mapper;

import com.liuyutao.Student.pojo.Student;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class StudentMapperImpl extends SqlSessionDaoSupport implements StudentMapper {

    @Override
    public Student findStudentById(Integer id) {
        return this.getSqlSession().getMapper(StudentMapper.class).findStudentById(id);
    }

    @Override
    public List<Student> findStudentByName(String name) {
        return this.getSqlSession().getMapper(StudentMapper.class).findStudentByName(name);
    }

    @Override
    public Student findStudentByNameAndAddress(String name, String address) {
        return this.getSqlSession().getMapper(StudentMapper.class).findStudentByNameAndAddress(name, address);

    }

    @Override
    public void deleteStudentById(Integer id) {
        this.getSqlSession().getMapper(StudentMapper.class).deleteStudentById(id);
        System.out.println("删除成功");
    }

    @Override
    public void addStudent(Student student) {
        this.getSqlSession().getMapper(StudentMapper.class).addStudent(student);
        System.out.println("添加成功:"+ student );
    }

    @Override
    public void updateStudent(Student student,Integer id) {
        this.getSqlSession().getMapper(StudentMapper.class).updateStudent(student,id);
    }
}
